package lunadevs.luna.module.exploits;

import org.lwjgl.input.Keyboard;

import com.darkmagician6.eventapi.EventTarget;

import lunadevs.luna.category.Category;
import lunadevs.luna.events.PacketSendEvent;
import lunadevs.luna.module.Module;
import net.minecraft.client.Minecraft;
import net.minecraft.network.play.client.C03PacketPlayer;

public class AntiHunger extends Module {

	public AntiHunger() {
		super("AntiHunger", Keyboard.KEY_NONE, Category.EXPLOITS, true);
	}

	@EventTarget
	public void onSendPacket(final PacketSendEvent e) {
		if (!this.isEnabled && e.getPacket() instanceof C03PacketPlayer && mc.thePlayer.fallDistance <= 2.0f) {
			final C03PacketPlayer packet = (C03PacketPlayer) e.getPacket();
			packet.field_149474_g = false;
		}
	}

	@Override
	public void onEnable() {
	}

	@Override
	public void onDisable() {
		Minecraft.thePlayer.capabilities.isFlying = false;
		super.onDisable();
	}

	@Override
	public String getValue() {
		return "Ground";
	}

}
